Skip to content

Conversation

@dumko2001
Copy link

Fixes #33995

Allow users to pass additional kwargs (like tool_choice) to with_structured_output() to avoid 400 errors when the model doesn't trigger a tool call. This aligns ChatGroq with ChatOpenAI behavior.

Users can now override the default tool_choice:
llm.with_structured_output(Schema, tool_choice="auto")

Description: Allow users to pass additional keyword arguments (like tool_choice) to with_structured_output() to avoid 400 errors when the model doesn't trigger a tool call. This aligns ChatGroq.with_structured_output() with ChatOpenAI.with_structured_output() behavior by removing the kwargs restriction and passing them through to bind_tools() and bind() methods.

Issue: Fixes #33995

Dependencies: None

Fixes langchain-ai#33995

Allow users to pass additional kwargs (like tool_choice) to
with_structured_output() to avoid 400 errors when the model
doesn't trigger a tool call. This aligns ChatGroq with ChatOpenAI
behavior.

Users can now override the default tool_choice:
  llm.with_structured_output(Schema, tool_choice="auto")
@github-actions github-actions bot added integration Related to a provider partner package integration groq labels Nov 20, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Nov 20, 2025

CodSpeed Performance Report

Merging #34053 will not alter performance

Comparing dumko2001:fix/groq-with-structured-output-kwargs (4815f18) with master (525d5c0)1

Summary

✅ 1 untouched
⏩ 33 skipped2

Footnotes

  1. No successful run was found on master (ee3373a) during the generation of this report, so 525d5c0 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 33 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@dumko2001 dumko2001 changed the title groq: allow kwargs in with_structured_output to override tool_choice feat(groq): Allow kwargs in with_structured_output to override tool_choice Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature groq integration Related to a provider partner package integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ChatGroq setting wrong toolcall flag in resulting API call.

1 participant